Technical Field
This disclosure relates to computing systems, and, more particularly, to a memory page mapping overlay system.
Description of the Related Art
In computer systems that implement virtual memory, operating systems or managed runtimes on occasion need to alter the attributes of particular segments of memory. For example, access permissions for certain segments of an address space may be changed from “read/write” to “read only” or from “read only” to “no access.” This may occur to prevent an application thread from accessing a contingent data structure, such as a page that is being modified by a runtime executive. For example, a garbage collector may lock down a region of heap memory while it operates on its contents, in order to prevent concurrent access by mutator threads. As another example, an operating system performing a copy-on-write optimization may change access permission for a single page of memory to be writable private storage, while surrounding pages are mapped from a file.
To change access permissions for a particular page of memory, a computer system can change access permissions for a corresponding page table entry of a translation lookaside buffer (TLB). Each page table entry of a TLB maps a virtual page to a physical page of memory, along with additional information associated with the physical page of memory, such as access permissions. Typically, memory pages are relatively small (e.g., 4 kilobytes or 8 kilobytes), which allows access permissions to be changed for small portions of memory. However, there are benefits for using larger memory pages (e.g., 4 megabytes or 1 gigabyte). Large memory pages allow a computer system to map addresses from a smaller working set of page mapping descriptors (e.g., using fewer bits). For example, one descriptor can cover many megabytes of memory instead of 8 kilobytes.
TLBs are in the critical path of memory access because elements of a TLB are consulted on each memory access. TLBs may burn hot and occupy a large amount of chip area. Therefore, implementing large page sizes can reduce the demand that is placed on a TLB. However, using large pages may also introduce inefficiencies that cause certain techniques, such copy-on-write or locking a page, to increase program execution time and reduce system performance. For example, changing access permission for a to gigabyte-sized memory page to “read-only” or “no-access” may interfere with and delay the execution of many different application threads.